//
//  Student.m
//  C7_学生数组
//
//  Created by dllo on 15/10/14.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "Student.h"


void printStudent(struct Student stu[], int count)
{

    for (int i = 0; i < count; i++) {
        printf("%s %c %d %.1f\n", stu[i].name, stu[i].sex, stu[i].age, stu[i].score);
    }

}

void sortStudent(struct Student stu[], int count)
{

    for (int i = 0; i < count - 1; i++) {
        for (int j = 0; j < count - i - 1; j++) {
            if (stu[j].score > stu[j + 1].score) {
                struct Student tempStu = stu[j];
                stu[j] = stu[j + 1];
                stu[j + 1] = tempStu;
            }
        }
    }
    printStudent(stu, count);
}



